<html>
<head>
<title>Informations sur la clinique</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="<?php echo base_url();?>css/jquery-ui.css" />
<script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>js/control.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready( function () {
	$("#go").click(function(){
		var id_clinique = $("#id_clinique").val();
		var email = $("#email").val();
		var mdp = $("#mdp").val();
		var pays = $("#pays").val();
		var map = $("#map").val();
		var ville = $("#ville").val();
		var nomville = $("#nomville").val();
		var adresse = $("#adresse").val();
		var code_postal = $("#code_postal").val();
		var nom_clinique = $("#nom_clinique").val();
		var surface = $("#surface").val();
		var fauteuil = $("#fauteuil").val();
		var scanner = $("#scanner").val();
		var prothese = $("#prothese").val();
		var marque_implant1 = $("#marque_implant1").val();
		var marque_implant2 = $("#marque_implant2").val();
		var marque_implant3 = $("#marque_implant3").val();
		var origine_materiaux1 = $("#origine_materiaux1").val();
		var origine_materiaux2 = $("#origine_materiaux2").val();
		var origine_materiaux3 = $("#origine_materiaux3").val();
		if (id_clinique != ""){
			$.post("<?php echo base_url();?>index.php/admin/updateInfoClinique", {email:email, mdp:mdp, pays:pays, map:map, ville:ville, adresse:adresse, code_postal:code_postal, nom_clinique:nom_clinique,surface:surface, fauteuil:fauteuil, scanner:scanner, prothese:prothese,marque_implant1:marque_implant1, marque_implant2:marque_implant2, marque_implant3:marque_implant3, origine_materiaux1:origine_materiaux1, origine_materiaux2:origine_materiaux2, origine_materiaux3:origine_materiaux3, nomville:nomville, id_clinique:id_clinique},				
					function(data){
						//alert("enregistr�");
						window.close();
					}
				);
			
		}
	});
	$("#fermer").click(function(){
		window.close();
	});

});
</script>
</head>
<body>
<input type="hidden" name="id_clinique" id="id_clinique" value="<?php echo $id_clinique; ?>" />
<div>
<?php
 		foreach ($result as $key => $list){	
		
?>
<table width="100%" border="0" cellspacing="5" cellpadding="0" style="font-size:14px;">  
<tr>
	<td colspan="2">
	<fieldset>
		<legend><h2>Donn&eacute;es de connexion </h2></legend>
		<table>
			<tr>
			    <td>
			    </td>
			</tr>
			<tr>
			    <td>Email </td>
			    <td>
					<input name="email" type="text"  id="email" class="mail obligatoire" value="<?php echo $list['email'];?>" />
				</td>
			</tr>

			<tr>
				<td>Mot de passe </td>
			    <td>
					<input name="mdp" type="password"  id="mdp"  value="<?php echo $list['mdp'];?>" class="obligatoire" />
				</td>
			</tr>
		</table>
	</fieldset>
	</td>
</tr>
<!--Debut Localit� -->
<tr>
	<td colspan="2">
	<fieldset>
		<legend><h2>Localit&eacute;</h2></legend>
		<table>
			<tr>
			    <td>
			    </td>
			</tr>
			<tr>
				<td>Pays</td>
				<td>				
					<select name="pays" id="pays" value="" class="obligatoire">
						<option value = ""  <?php if($list['id_pays']==""){ echo ' selected="selected"';} ?>>S&eacute;lectionner</option>
					<?php 
					foreach ($pays as $key => $listP){
						?>
						<option value="<?php echo $listP['id_pays']?>" <?php if($listP['id_pays']==$list['id_pays']){ echo ' selected="selected"';} ?>><?php echo $listP['nom_pays']?>
						</option>
						<?php 
					}
					?>
				    </select>
				</td>
			</tr>	
			<tr>
			    <td>Ville </td>
			    <td>
				<?php
					$nomVille = $this->MAdmin->selectNomVille($list['id_ville']);		
				?>
				    <input name="ville" type="hidden"  id="ville" class="" value="<?php echo $list['id_ville'];?>" />
					<input name="nomville" type="text"  id="nomville" class="obligatoire" value="<?php echo $nomVille;?>" />
							<?php
							/*if($id_pays_bd!=0){
								$ville_bd = $this->MDn->getAllVille($id_pays_bd);
								?>
								<select id="ville" name="ville" type="text" size="1" style="width:150px">
										<option value = ""  <?php if($list['id_ville']==""){ echo ' selected="selected"'; } ?>>S&eacute;lectionner</option>
										<?php 
										foreach ($ville_bd as $key => $listV){
											
											?>
								
											<option value="<?php echo $listV['id_ville']?>" <?php if($listV['id_ville']==$list['id_ville']){ echo ' selected="selected"'; $ville_ = $listV['nom_ville'];} ?>><?php echo $listV['nom_ville']?></option>
											<?php 
										}
										?>
								</select>
							<?php
							}
							else {
							?>
							<select id="ville" name="ville" type="text" size="1" style="width:150px">
									<option value = ""  <?php if($list['id_ville']==""){ echo ' selected="selected"';} ?>>S&eacute;lectionner</option>
									<?php 
									foreach ($ville as $key => $listV){
										$ville = $listV['nom_ville'];
										?>
										<option value="<?php echo $listV['id_ville']?>" <?php if($listV['id_ville']==$list['id_ville']){ echo ' selected="selected"'; $ville_ = $listV['nom_ville'];} ?>><?php echo $list3['nom_ville']?></option>
										<?php 
									}
									?>
							</select>
							<?php
							}*/
							?>
			</td>
			  </tr>
			<tr>
			    <td>Adresse </td>
			    <td>
					<input name="adresse" type="text"  id="adresse" value="<?php echo $list['adresse'];?>" class="obligatoire"/>
				</td>
			  </tr>
			<tr>
			    <td>Code postal </td>
			    <td>
					<input name="code_postal" type="text"  id="code_postal" value="<?php echo $list['code_postal'];?>" class="obligatoire"/>	
				</td>
			  </tr>
			<tr>
				 <td>Google Map</td>
			    <td>
					<textarea style="width:425px; height:200px;" name="map" id="map" value="<?php echo $list['map'];?>"><?php echo $list['map'];?></textarea><br/>	
					<span id="mapShow"><?php echo $list['map'];?></span>
				</td>
			</tr>
		</table>
	</fieldset>
	</td>
</tr>
<!--Fin Localit� -->
<!--Debut La clinique-->
<tr>
	<td colspan="2">
	<fieldset>
		<legend><h2>La clinique </h2></legend>
		<table>
			<tr>
			    <td>
			    </td>
			</tr>
			<tr>
			    <td>Nom de la clinique </td>
			    <td>
					<input name="nom_clinique" type="text"  id="nom_clinique" value="<?php echo $list['nom_clinique'];?>" class="obligatoire"/></td>
			  </tr>
			<tr>
			    <td>Surface </td>
			    <td>
				<select name="surface"id="surface" value="<?php echo $list['surface'];?>">
				<option value = ""  <?php if($list['surface']==""){ echo ' selected="selected"';} ?>>S&eacute;lectionner</option>
				<option value="30" <?php if($list['surface']=="30"){ echo ' selected="selected"';} ?>>30</option>
				<option value="40" <?php if($list['surface']=="40"){ echo ' selected="selected"';} ?>>40</option>
				<option value="50" <?php if($list['surface']=="50"){ echo ' selected="selected"';} ?>>50</option>
				<option value="60" <?php if($list['surface']=="60"){ echo ' selected="selected"';} ?>>60</option>
				<option value="70" <?php if($list['surface']=="70"){ echo ' selected="selected"';} ?>>70</option>
				<option value="80" <?php if($list['surface']=="80"){ echo ' selected="selected"';} ?>>80</option>
				<option value="90" <?php if($list['surface']=="90"){ echo ' selected="selected"';} ?>>90</option>
				<option value="100" <?php if($list['surface']=="100"){ echo ' selected="selected"';} ?>>100</option>
				<option value="110" <?php if($list['surface']=="110"){ echo ' selected="selected"';} ?>>110</option>
				<option value="120" <?php if($list['surface']=="120"){ echo ' selected="selected"';} ?>>120</option>
				<option value="130" <?php if($list['surface']=="130"){ echo ' selected="selected"';} ?>>130</option>
				<option value="140" <?php if($list['surface']=="140"){ echo ' selected="selected"';} ?>>140</option>
				<option value="150" <?php if($list['surface']=="150"){ echo ' selected="selected"';} ?>>150</option>
				<option value="160" <?php if($list['surface']=="160"){ echo ' selected="selected"';} ?>>160</option>
				<option value="170" <?php if($list['surface']=="170"){ echo ' selected="selected"';} ?>>170</option>
				<option value="180" <?php if($list['surface']=="180"){ echo ' selected="selected"';} ?>>180</option>
				<option value="190" <?php if($list['surface']=="190"){ echo ' selected="selected"';} ?>>190</option>
				<option value="200" <?php if($list['surface']=="200"){ echo ' selected="selected"';} ?>>200</option>
				<option value="210" <?php if($list['surface']=="210"){ echo ' selected="selected"';} ?>>210</option>
				<option value="220" <?php if($list['surface']=="220"){ echo ' selected="selected"';} ?>>220</option>
				<option value="230" <?php if($list['surface']=="230"){ echo ' selected="selected"';} ?>>230</option>
				<option value="240" <?php if($list['surface']=="240"){ echo ' selected="selected"';} ?>>240</option>
				<option value="250" <?php if($list['surface']=="250"){ echo ' selected="selected"';} ?>>250</option>
				<option value="260" <?php if($list['surface']=="260"){ echo ' selected="selected"';} ?>>260</option>
				<option value="270" <?php if($list['surface']=="270"){ echo ' selected="selected"';} ?>>270</option>
				<option value="280" <?php if($list['surface']=="280"){ echo ' selected="selected"';} ?>>280</option>
				<option value="290" <?php if($list['surface']=="290"){ echo ' selected="selected"';} ?>>290</option>
				<option value="300" <?php if($list['surface']=="300"){ echo ' selected="selected"';} ?>>300</option>
				<option value="310" <?php if($list['surface']=="310"){ echo ' selected="selected"';} ?>>310</option>
				<option value="320" <?php if($list['surface']=="320"){ echo ' selected="selected"';} ?>>320</option>
				<option value="330" <?php if($list['surface']=="330"){ echo ' selected="selected"';} ?>>330</option>
				<option value="340" <?php if($list['surface']=="340"){ echo ' selected="selected"';} ?>>340</option>
				<option value="350" <?php if($list['surface']=="350"){ echo ' selected="selected"';} ?>>350</option>
				<option value="360" <?php if($list['surface']=="360"){ echo ' selected="selected"';} ?>>360</option>
				<option value="370" <?php if($list['surface']=="370"){ echo ' selected="selected"';} ?>>370</option>
				<option value="380" <?php if($list['surface']=="380"){ echo ' selected="selected"';} ?>>380</option>
				<option value="390" <?php if($list['surface']=="390"){ echo ' selected="selected"';} ?>>390</option>
				<option value="400" <?php if($list['surface']=="400"){ echo ' selected="selected"';} ?>>400</option>
				<option value="410" <?php if($list['surface']=="410"){ echo ' selected="selected"';} ?>>410</option>
				<option value="420" <?php if($list['surface']=="420"){ echo ' selected="selected"';} ?>>420</option>
				<option value="430" <?php if($list['surface']=="430"){ echo ' selected="selected"';} ?>>430</option>
				<option value="440" <?php if($list['surface']=="440"){ echo ' selected="selected"';} ?>>440</option>
				<option value="450" <?php if($list['surface']=="450"){ echo ' selected="selected"';} ?>>450</option>
				<option value="460" <?php if($list['surface']=="460"){ echo ' selected="selected"';} ?>>460</option>
				<option value="470" <?php if($list['surface']=="470"){ echo ' selected="selected"';} ?>>470</option>
				<option value="480" <?php if($list['surface']=="480"){ echo ' selected="selected"';} ?>>480</option>
				<option value="490" <?php if($list['surface']=="490"){ echo ' selected="selected"';} ?>>490</option>
				<option value="500" <?php if($list['surface']=="500"){ echo ' selected="selected"';} ?>>500</option>
			    </select>
				m�</td>
			</tr>
			<tr>
			    <td>Nombre de fauteuils</td>
			    <td>
					<select name="fauteuil"id="fauteuil">
					<option value = ""  <?php if($nb_fauteuil==""){ echo ' selected="selected"';} ?>>S&eacute;lectionner</option>
				    <?php
				      for ($i = 1; $i <= 10; $i++)
				      {
						  $var = "";
						  $nb_fauteuil = $list['fauteuil'];
						  if ($i == $nb_fauteuil){
							  $var ="selected=selected";
						  }
					echo '<option value="' . $i . '" '.$var.'>' . $i . '</option>';
				      }
				    ?>
				</select>
			</td>
			</tr>
			<tr>
			    <td>Scanner </td>
			    <td>
					<input type="radio" name="scanner" id="scannerOui" value="Oui" <?php if($list['scanner']=='Oui'){ echo ' checked="checked"';} ?> />Oui
					<input type="radio" name="scanner" value="Non" id="scannerNon" <?php if($list['scanner']=='Non'){ echo ' checked="checked"';} ?> />Non
				</td>
			</tr>
			<tr>
			    <td>Laboratoire proth&egrave;se dentaire sur place </td>
			    <td>
					<input type="radio" name="prothese" id="protheseOui" value="Oui" <?php if($list['prothese']=='Oui'){ echo ' checked="checked"';} ?> />Oui
					<input type="radio" name="prothese" id="protheseNon" value="Non" <?php if($list['prothese']=='Non'){ echo ' checked="checked"';} ?> >Non
				</td>
			</tr>
		</table>
	</fieldset>
	</td>
</tr>
<!--Fin la clinique-->
<!--Debut Materiels et Mat�riaux-->
<tr>
	<td colspan="2">
	<!-- Debut denn�es de connexion -->
	<fieldset>
		<legend><h2>Mat&eacute;riels et mat&eacute;riaux</h2></legend>
		<table>
			<tr>
			    <td>
			    </td>
			</tr>
			<?php
				if($list['marque_implant1'] != ""){
			?>
			<tr>
			    <td>Marque 1</td>
			    <td>
					<input name="marque_implant1" type="text"  id="marque_implant1" value="<?php echo $list['marque_implant1'];?>" class="obligatoire"/>	
				</td>
			</tr>			
			<?php
				}
			?>
			<?php
				if($list['marque_implant2'] != ""){
			?>
			<tr>
			    <td>Marque 2 </td>
			    <td>
					<input name="marque_implant2" type="text"  id="marque_implant2" value="<?php echo $list['marque_implant2'];?>" class="obligatoire"/>	
				</td>
			</tr>			
			<?php
				}
			?>
			<?php
				if($list['marque_implant3'] != ""){
			?>
			<tr>
			    <td>Marque 3 </td>
			    <td>
					<input name="marque_implant3" type="text"  id="marque_implant3" value="<?php echo $list['marque_implant3'];?>" class="obligatoire"/>	
				</td>
			</tr>			
			<?php
				}
			?>
			<tr>
				<td colspan="2">Origine des principaux mat&eacute;riaux utilis&eacute;s en bouche </td>
			</tr>
			<?php
				if($list['origine_materiaux1'] != ""){
			?>
			<tr>
			    <td>Origine 1 </td>
			    <td>
					<select name="origine_materiaux1" id="origine_materiaux1" value="" class="obligatoire">
						<?php 
						foreach ($origine_materiaux1 as $key => $list1){
						?>
							<option value="<?php echo $list1['id_pays']?>" <?php if($list1['id_pays']==$list['origine_materiaux1']){ echo ' selected="selected"'; } ?>><?php echo $list1['nom_pays']?>
							</option>
						<?php 
						}
						?>
					</select>
				</td>
			</tr>			
			<?php
				}
			?>
			<?php
				if($list['origine_materiaux2'] != ""){
			?>
			<tr>
			    <td>Origine 2</td>
			    <td>
					<select name="origine_materiaux2" id="origine_materiaux2" value="" class="obligatoire">
						<?php 
						foreach ($origine_materiaux2 as $key => $list2){
						?>
							<option value="<?php echo $list2['id_pays']?>" <?php if($list2['id_pays']==$list['origine_materiaux2']){ echo ' selected="selected"';} ?>><?php echo $list2['nom_pays']?>
							</option>
						<?php 
						}
						?>
					</select>
				</td>
			</tr>			
			<?php
				}
			?>
			<?php
				if($list['origine_materiaux3'] != ""){
			?>
			<tr>
			    <td>Origine 3</td>
			    <td>
					<select name="origine_materiaux3" id="origine_materiaux3" value="" class="obligatoire">
						<?php 
						foreach ($origine_materiaux3 as $key => $list3){
						?>
							<option value="<?php echo $list3['id_pays']?>" <?php if($list3['id_pays']==$list['origine_materiaux3']){ echo ' selected="selected"';} ?>><?php echo $list3['nom_pays']?>
							</option>
						<?php 
						}
						?>
					</select>
				</td>
			</tr>			
			<?php
				}
			?>
		</table>
	</fieldset>
	</td>
</tr>  
</table>    
<?php
}		
?>
<div style="float:center">
		<input type="submit" name="submit" id="go" value="Enregistrer modifications" />
		<input type="button" name="button" id="fermer" value="Fermer" />
</div>
</div>
</body>
</html>